<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var num = prompt("请输入班级总人数");
        var score = 0
        for (var i = 1; i <= num; i++) {
            var one = prompt("请输入第" + i + "个学生的成绩");
            one = Number(one)
            score += one
        }
        alert("总成绩是:" + score);
        var avg = score / num;
        alert("平均成绩是" + avg)
    </script>
</body>

</html>